<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <script>
    fetch('./id.json')
    .then(res => res.json())
    .then(data=>{
      console.log(data);
      return fetch('./detail.json')
      })
      .then(detail=>detail.json())
      .then(data=>{
        console.log('detail',data)
      })
      //异步终极解决方式
      //await 后面接 promise 
     async function getDatail(){
       //fetch 异步
       let id = await fetch('./id.json');
       //转为 json 也是异步的
        id = - id.json();
        let detail = await fetch('./detail.json');
        detail =detail.json();
        console.log('await',detail)
      }
      getDatail();
  </script>
</body>
</html>